<?php
/**
 * 处理文件上传类
 * Created by PhpStorm.
 * User: yhz
 * Date: 2017-12-29
 * Time: 23:17
 */

namespace app\admin\controller;


use app\base\Tools;

class Upload
{
    /***
     * 头像上传处理
     * @return \think\response\Json
     */
    public function headUpload()
    {
        $file = request()->file('file');

        if ($file) {
            $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads/admin/avatar');

        }
        return Tools::ajaxReturn(true, '上传成功',str_replace('\\','/',$info->getSaveName()) );

    }
}